package com.ruoyi.product.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.mapper.ProductMemberUnionMapper;
import com.ruoyi.db.domain.ProductMemberUnion;
import com.ruoyi.product.service.IProductMemberUnionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 联登用户Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-07-31
 */
@Service
@DataSource(DataSourceType.SLAVE)
public class ProductMemberUnionServiceImpl implements IProductMemberUnionService 
{
    @Autowired
    private ProductMemberUnionMapper productMemberUnionMapper;

    /**
     * 查询联登用户
     * 
     * @param productId 联登用户主键
     * @return 联登用户
     */
    @Override
    public ProductMemberUnion selectProductMemberUnionByProductId(Long productId)
    {
        return productMemberUnionMapper.selectProductMemberUnionByProductId(productId);
    }

    /**
     * 查询联登用户列表
     * 
     * @param productMemberUnion 联登用户
     * @return 联登用户
     */
    @Override
    public List<ProductMemberUnion> selectProductMemberUnionList(ProductMemberUnion productMemberUnion)
    {
        return productMemberUnionMapper.selectProductMemberUnionList(productMemberUnion);
    }

    /**
     * 查询联登用户列表
     *
     * @param productMemberUnion 联登用户
     * @return 联登用户
     */
    @Override
    public List<Map<String, Object>> selectProductMemberUnionListMap(ProductMemberUnion productMemberUnion)
    {
        return productMemberUnionMapper.selectProductMemberUnionListMap(productMemberUnion);
    }

    /**
     * 新增联登用户
     * 
     * @param productMemberUnion 联登用户
     * @return 结果
     */
    @Override
    public int insertProductMemberUnion(ProductMemberUnion productMemberUnion)
    {
        productMemberUnion.setCreateTime(DateUtils.getNowDate());
        return productMemberUnionMapper.insertProductMemberUnion(productMemberUnion);
    }

    /**
     * 修改联登用户
     * 
     * @param productMemberUnion 联登用户
     * @return 结果
     */
    @Override
    public int updateProductMemberUnion(ProductMemberUnion productMemberUnion)
    {
        productMemberUnion.setUpdateTime(DateUtils.getNowDate());
        return productMemberUnionMapper.updateProductMemberUnion(productMemberUnion);
    }

    /**
     * 批量删除联登用户
     * 
     * @param productIds 需要删除的联登用户主键
     * @return 结果
     */
    @Override
    public int deleteProductMemberUnionByProductIds(String productIds)
    {
        return productMemberUnionMapper.deleteProductMemberUnionByProductIds(Convert.toStrArray(productIds));
    }

    /**
     * 删除联登用户信息
     * 
     * @param productId 联登用户主键
     * @return 结果
     */
    @Override
    public int deleteProductMemberUnionByProductId(Long productId)
    {
        return productMemberUnionMapper.deleteProductMemberUnionByProductId(productId);
    }
}
